<template>
  <div class="item" @click="fun1(id)">
   <img :src="imgurl" alt="">
   <br>
   <span>{{tit1|sheng}}</span>
  </div>
</template>

<script>
export default {
  props:["tit1","imgurl","id"],
  // 过滤器
  filters:{
    sheng(val){
      if(val.length>6){
        return val.substr(0,5)+"..."
      }
      else{
        return val;
      }
    }
  },
  methods:{
    fun1(id){
      // this.$router.push("./xiangqing")
      //路由传参
      //params方式发送
      //this.$router.push({name:"你要去的路由的名字",params:{你要传递的参数key:val}});
      // this.$router.push({name:"detail",params:{xi:id}})
      this.$router.push({name:"detail",query:{xi:id}})
    }
  }

}
</script>

<style>
  .item img{
    width:1rem;
    height: 1.8rem;
    margin-right: 0.1rem;
  }
</style>